import axios from 'axios'
let baseUrl = "http://127.0.0.1:3000"
let request = ({
    url,
    data = {},
    method = 'GET'
}) => {
    return new Promise((resolve, reject) => {
        axios({
            url: baseUrl + url,
            method,
            data
        }).then(res => {
            if (res.data.code == 200) {
                resolve(res.data)
            } else {
                reject()
            }
        })
    })
}
class apiModel {
    //获取首页轮播图
    getBanner() {
        return request({
            url:'/banner'
        })
    }
    //获取首页展示信息
    getPageinfo(){
        return request({
            url:'/homepage/block/page'
        })
    }
}
export {
    apiModel
}